import { useState, useEffect } from "react"

function App() {
  const [count, setCount] = useState(2)
  const [num, setNum] = useState(10)


  // componentDidMount  组件挂载完成
  useEffect(() => {
    console.log('useEffect');
  }, [count, num])    // count 变化，充当组件更新执行

  // console.log('App');  ajax


  const add = () => {
    setCount(count + 1)
    // setNum(num + 1)
  }

  return (
    <button onClick={add}>{count}</button>
  )
}

export default App